home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / powerd / lib / chunky.lha / chunky / HLine.ass < prev    next >
Encoding:
Text File  |  1980-11-11  |  838 b   |  43 lines

  1.  
  2. ; HLine(chunky:a0:PTR TO chunky,x1:d0:LONG,x2:d1:LONG,y:d2:LONG,colour:d3:LONG)(LONG)
  3.  
  4.     machine    mc68020
  5.  
  6.     xdef    _HLine
  7.  
  8. _HLine
  9.     movem.l    d2-d5,-(a7)
  10.     move.l    (a0),d4
  11.     move.l    (4,a0),d5
  12.     movea.l    (8,a0),a1
  13.     tst.l    d2
  14.     blt.s    .finish        ; above screen
  15.     cmp.l    d2,d5
  16.     ble.s    .finish        ; below screen
  17.     cmp.l    d0,d1
  18.     bge.s    .continue
  19.     exg    d0,d1        ; forces d0 to contain lower value
  20. .continue    tst.l    d1
  21.     blt.s    .finish        ; left to the screen
  22.     cmp.l    d0,d4
  23.     ble.s    .finish        ; right to the screen
  24.  
  25.     tst.l    d0
  26.     bge.s    .next1        ; clip by left side
  27.     moveq    #0,d0
  28. .next1    cmp.l    d1,d4
  29.     bgt.s    .next2        ; clip by right side
  30.     move.l    d4,d1
  31.     subq.w    #1,d1
  32. .next2
  33.     muls.l    d4,d2
  34.     add.l    d0,d2        ; d2 contains position of first pixel
  35.     sub.l    d0,d1        ; d1 contains count of pixels
  36.     add.l    d2,a1        ; set first position
  37.  
  38. .loop    move.b    d3,(a1)+
  39.     dbra.s    d1,.loop
  40.  
  41. .finish    movem.l    (a7)+,d2-d5
  42.     rts
  43.